package cc.sjfx.sharedoc.widget.view;

import cc.sjfx.sharedoc.R;
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class MyHeadLayout extends RelativeLayout{
	ImageButton headImgBut;
	TextView titleText;
	private ImageButton userSetImgBut;
	Context context;
	public static MyHeadLayout layout;
	public MyHeadLayout(Context context, AttributeSet attr) {
		super(context, attr);
		this.context = context;
		LayoutInflater.from(context).inflate(R.layout.layout_header, this);
		headImgBut = (ImageButton) findViewById(R.id.headImgBut);
		titleText = (TextView) findViewById(R.id.headTitle);
		userSetImgBut=(ImageButton)findViewById(R.id.userSetImgBut);
		headImgBut.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				((Activity) getContext()).finish();
			}
		});

	}
	public void setTitle(String title) {
		titleText.setText(title);
	}
	public void setTitleTextVisibility(int visibility) {
		titleText.setVisibility(visibility);
	}
	public void setButtonVisibility(int visibility) {
		headImgBut.setVisibility(visibility);
	}
	public void setSetButtonVisibility(int visibility) {
		userSetImgBut.setVisibility(visibility);
	}
}
